#ifndef WINDOWMANAGER_H
#define WINDOWMANAGER_H



#include "windowmanagerlogger.h"
#include "screen.h"

#include "exception.h"

namespace X11 {
    #include <X11/Xlib.h>
    #include <X11/keysym.h>
}


class WindowManager
{
public:
    WindowManager();
    virtual ~WindowManager();


    void start();
    void run();
    void stop();
    void quit();

    // handlers
    void createNotify(X11::XEvent *ev);
    void destroyNotify(X11::XEvent *ev);
    void configureRequest(X11::XEvent *ev);
    void mapRequest(X11::XEvent *ev);
    void keyPress(X11::XEvent *ev) ;

    Screen *getScreen(int id) const { return v_screenList.at(id); }
    Screen *getCurrentScreen() const { return p_currentScreen; }

    private:

private:
    WindowManagerLogger v_logger;
    bool m_is_running;
    QList<Screen *> v_screenList;
    Screen* p_currentScreen;
    X11::Display *p_display;
};


class WindowManagerException : public Exception{
public:
    WindowManagerException(const QString& error) : Exception(error)
    {

    }
};

#endif // WINDOWMANAGER_H
